
import {env} from "../env/env";
import {showToastError} from "../utils/tool";
import {simpleGet} from "../utils/request";


export const getAreaList = (params) => {
    return simpleGet("/sundry/area", params)
}

export const getAllAreas = () => {
    return new Promise(resolve => {
        wx.request({
            url:env.host+'/area.json',
            method:"GET",
            success:(res) => {
                resolve(res.data)
            },
            fail:(err) => {
                showToastError("地区信息请求失败")
            }
        })
    })

}

// wx.request({
//     url: app.host+'/area.json',
//     success: function(data){
//         var area_data = data.data;
//         var user_batch_city_area = userInfo.user_batch_city_area.split(',');
//         var id_arr = [];
//         user_batch_city_area.forEach(item=>{
//             id_arr.push(parseInt(item));
//         })
//         var text = that.get_tree_text(area_data,id_arr,'');
//         var tree_area = {id_arr: id_arr, text: text};
//         that.setData({
//             area_data: area_data,
//             tree_area: tree_area,
//         })
//
//     }
// })
